package com.hh.org.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 黄浩
 * @create 2022-06-01 12:51
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_department")
public class Dept implements Serializable {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String sn;
    private String name;
    private String dirPath;
    private Integer state;
    private Long managerId;
    private Long parentId;
    private Long shopId;

    @TableField(exist = false)
    private Emp manager;
    @TableField(exist = false)
    private Dept parent;

    @TableField(exist = false)
    @JsonInclude(JsonInclude.Include.NON_EMPTY)//为空就不返回
    private List<Dept> children = new ArrayList<>();

/*    public Long getManagerId() {
        if (this.manager!=null){
            return this.manager.getId();
        }
        return null;
    }

    public Long getParentId() {
        if (this.parent!=null){
            return this.parent.getId();
        }
        return null;
    }*/
}
